package com.myschool.server.model;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "section")
public class Section extends BaseEntity {

	@Column(name = "class_room", length = 4)
	private String classRoomNo;

	@Column(name = "section_Name", nullable = false)
	private String sectionName;

	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	private Grade grade;

	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	private User classTeacher;

	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	private Set<User> students;

	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	private Set<Subject> subjects;

	@Enumerated(EnumType.STRING)
	private TimeTableType timeTableType;

	public Grade getGrade() {
		return grade;
	}

	public void setGrade(Grade grade) {
		this.grade = grade;
	}

	public Set<User> getStudents() {
		return students;
	}

	public void setStudents(Set<User> students) {
		this.students = students;
	}

	/**
	 * @return the subject
	 */
	public Set<Subject> getSubjects() {
		return subjects;
	}

	/**
	 * @param subject
	 *            the subject to set
	 */
	public void setSubjects(Set<Subject> subjects) {
		this.subjects = subjects;
	}

	public User getClassTeacher() {
		return classTeacher;
	}

	public void setClassTeacher(User classTeacher) {
		this.classTeacher = classTeacher;
	}

	public String getSectionName() {
		return sectionName;
	}

	public void setSectionName(String sectionName) {
		this.sectionName = sectionName;
	}

	/**
	 * @return the timeTableType
	 */
	public TimeTableType getTimeTableType() {
		return timeTableType;
	}

	/**
	 * @param timeTableType
	 *            the timeTableType to set
	 */
	public void setTimeTableType(TimeTableType timeTableType) {
		this.timeTableType = timeTableType;
	}

	/**
	 * @return the classRoomNo
	 */
	public String getClassRoomNo() {
		return classRoomNo;
	}

	/**
	 * @param classRoomNo
	 *            the classRoomNo to set
	 */
	public void setClassRoomNo(String classRoomNo) {
		this.classRoomNo = classRoomNo;
	}

}
